<?php
/************************************************************************/
/* FrameWork                                                            */
/* ==================================================================== */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/*									*/
/* plugin theme								*/
/*									*/
/************************************************************************/

	switch($lang){
	    case "en":
		define("_THEME_SELECTOR","THEME SELECTOR");
		define("_SET","set");
		break;
	    default:
		define("_THEME_SELECTOR","SELETTORE DEI TEMI");
		define("_SET","set");
		break;
	}


?>
    <fieldset>
    <i><legend> <?=_THEME_SELECTOR?> </legend></i>

	<form action="index.php">
	    <select name='theme'>
	    <?php
		$hdir=opendir("themes/");
		$i=0;
		while (false !== ($f= readdir($hdir))){
		    if ($f[0]!="."){
			$listthemes[$i]=$f;
			$i++;
		    }
		}
		sort($listthemes);
		$user_theme=user_getkey($user,"user_theme");
		echo("<option>$user_theme</option>\n");
		foreach( $listthemes as $themesel){
		    echo("<option>$themesel</option>\n");
		}
	    ?>
	    </select>
	<input type="submit" value="<?=_SET?>"/>
	</form>
<?php
    $theme=$_GET['theme'];
    if ($theme!=""){
	user_setkey($user,"user_theme",$theme);
	echo "<script language=javascript>window.location='index.php';</script>";
    }
?>
    </fieldset>
